using UnityEngine;

namespace CinemaDirector
{
	public abstract class TimelineTrack : MonoBehaviour
	{
		[SerializeField]
		private int ordinal = -1;

		protected float elapsedTime;

		protected TrackGroup trackGroup;

		protected TimelineItem[] timelineItems;

		public Cutscene Cutscene
		{
			get
			{
				return TrackGroup.Cutscene;
			}
		}

		public TrackGroup TrackGroup
		{
			get
			{
				if (!Application.isPlaying)
				{
					return base.transform.parent.GetComponent<TrackGroup>();
				}
				if (trackGroup == null)
				{
					trackGroup = base.transform.parent.GetComponent<TrackGroup>();
				}
				return trackGroup;
			}
		}

		public int Ordinal
		{
			get
			{
				return ordinal;
			}
			set
			{
				ordinal = value;
			}
		}

		public virtual TimelineItem[] TimelineItems
		{
			get
			{
				if (timelineItems == null || !Application.isPlaying)
				{
					timelineItems = GetComponentsInChildren<TimelineItem>();
				}
				return timelineItems;
			}
		}

		public virtual void Initialize()
		{
		}

		public virtual void UpdateTrack(float runningTime, float deltaTime)
		{
		}

		public virtual void Pause()
		{
		}

		public virtual void Resume()
		{
		}

		public virtual void SetTime(float time)
		{
		}

		public virtual void Stop()
		{
		}
	}
}
